{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer</th>\n",
       "      <th>order</th>\n",
       "      <th>total_items</th>\n",
       "      <th>discount%</th>\n",
       "      <th>weekday</th>\n",
       "      <th>hour</th>\n",
       "      <th>Food%</th>\n",
       "      <th>Fresh%</th>\n",
       "      <th>Drinks%</th>\n",
       "      <th>Home%</th>\n",
       "      <th>Beauty%</th>\n",
       "      <th>Health%</th>\n",
       "      <th>Baby%</th>\n",
       "      <th>Pets%</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>45</td>\n",
       "      <td>23.03</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>9.46</td>\n",
       "      <td>87.06</td>\n",
       "      <td>3.48</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>38</td>\n",
       "      <td>1.22</td>\n",
       "      <td>5</td>\n",
       "      <td>13</td>\n",
       "      <td>15.87</td>\n",
       "      <td>75.80</td>\n",
       "      <td>6.22</td>\n",
       "      <td>2.12</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>51</td>\n",
       "      <td>18.08</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>16.88</td>\n",
       "      <td>56.75</td>\n",
       "      <td>3.37</td>\n",
       "      <td>16.48</td>\n",
       "      <td>6.53</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>57</td>\n",
       "      <td>16.51</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>28.81</td>\n",
       "      <td>35.99</td>\n",
       "      <td>11.78</td>\n",
       "      <td>4.62</td>\n",
       "      <td>2.87</td>\n",
       "      <td>15.92</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>53</td>\n",
       "      <td>18.31</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>24.13</td>\n",
       "      <td>60.38</td>\n",
       "      <td>7.78</td>\n",
       "      <td>7.72</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   customer  order  total_items  discount%  weekday  hour  Food%  Fresh%  \\\n",
       "0         0      0           45      23.03        4    13   9.46   87.06   \n",
       "1         0      1           38       1.22        5    13  15.87   75.80   \n",
       "2         0      2           51      18.08        4    13  16.88   56.75   \n",
       "3         1      3           57      16.51        1    12  28.81   35.99   \n",
       "4         1      4           53      18.31        2    11  24.13   60.38   \n",
       "\n",
       "   Drinks%  Home%  Beauty%  Health%  Baby%  Pets%  \n",
       "0     3.48   0.00     0.00     0.00    0.0    0.0  \n",
       "1     6.22   2.12     0.00     0.00    0.0    0.0  \n",
       "2     3.37  16.48     6.53     0.00    0.0    0.0  \n",
       "3    11.78   4.62     2.87    15.92    0.0    0.0  \n",
       "4     7.78   7.72     0.00     0.00    0.0    0.0  "
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv(\"../data/order.csv\") "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据探索"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据特征分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>customer</th>\n",
       "      <th>order</th>\n",
       "      <th>total_items</th>\n",
       "      <th>discount%</th>\n",
       "      <th>weekday</th>\n",
       "      <th>hour</th>\n",
       "      <th>Food%</th>\n",
       "      <th>Fresh%</th>\n",
       "      <th>Drinks%</th>\n",
       "      <th>Home%</th>\n",
       "      <th>Beauty%</th>\n",
       "      <th>Health%</th>\n",
       "      <th>Baby%</th>\n",
       "      <th>Pets%</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>45</td>\n",
       "      <td>23.03</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>9.46</td>\n",
       "      <td>87.06</td>\n",
       "      <td>3.48</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>38</td>\n",
       "      <td>1.22</td>\n",
       "      <td>5</td>\n",
       "      <td>13</td>\n",
       "      <td>15.87</td>\n",
       "      <td>75.80</td>\n",
       "      <td>6.22</td>\n",
       "      <td>2.12</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>2</td>\n",
       "      <td>51</td>\n",
       "      <td>18.08</td>\n",
       "      <td>4</td>\n",
       "      <td>13</td>\n",
       "      <td>16.88</td>\n",
       "      <td>56.75</td>\n",
       "      <td>3.37</td>\n",
       "      <td>16.48</td>\n",
       "      <td>6.53</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1</td>\n",
       "      <td>3</td>\n",
       "      <td>57</td>\n",
       "      <td>16.51</td>\n",
       "      <td>1</td>\n",
       "      <td>12</td>\n",
       "      <td>28.81</td>\n",
       "      <td>35.99</td>\n",
       "      <td>11.78</td>\n",
       "      <td>4.62</td>\n",
       "      <td>2.87</td>\n",
       "      <td>15.92</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>1</td>\n",
       "      <td>4</td>\n",
       "      <td>53</td>\n",
       "      <td>18.31</td>\n",
       "      <td>2</td>\n",
       "      <td>11</td>\n",
       "      <td>24.13</td>\n",
       "      <td>60.38</td>\n",
       "      <td>7.78</td>\n",
       "      <td>7.72</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29995</th>\n",
       "      <td>10235</td>\n",
       "      <td>29995</td>\n",
       "      <td>4</td>\n",
       "      <td>0.00</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>5.80</td>\n",
       "      <td>0.00</td>\n",
       "      <td>51.30</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>42.9</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29996</th>\n",
       "      <td>10236</td>\n",
       "      <td>29996</td>\n",
       "      <td>1</td>\n",
       "      <td>0.00</td>\n",
       "      <td>7</td>\n",
       "      <td>21</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>100.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29997</th>\n",
       "      <td>10237</td>\n",
       "      <td>29997</td>\n",
       "      <td>54</td>\n",
       "      <td>0.00</td>\n",
       "      <td>4</td>\n",
       "      <td>17</td>\n",
       "      <td>9.25</td>\n",
       "      <td>0.00</td>\n",
       "      <td>77.48</td>\n",
       "      <td>13.27</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29998</th>\n",
       "      <td>10237</td>\n",
       "      <td>29998</td>\n",
       "      <td>10</td>\n",
       "      <td>0.00</td>\n",
       "      <td>5</td>\n",
       "      <td>10</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>100.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29999</th>\n",
       "      <td>10238</td>\n",
       "      <td>29999</td>\n",
       "      <td>2</td>\n",
       "      <td>0.00</td>\n",
       "      <td>4</td>\n",
       "      <td>17</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>30000 rows × 14 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       customer  order  total_items  discount%  weekday  hour  Food%  Fresh%  \\\n",
       "0             0      0           45      23.03        4    13   9.46   87.06   \n",
       "1             0      1           38       1.22        5    13  15.87   75.80   \n",
       "2             0      2           51      18.08        4    13  16.88   56.75   \n",
       "3             1      3           57      16.51        1    12  28.81   35.99   \n",
       "4             1      4           53      18.31        2    11  24.13   60.38   \n",
       "...         ...    ...          ...        ...      ...   ...    ...     ...   \n",
       "29995     10235  29995            4       0.00        5    10   5.80    0.00   \n",
       "29996     10236  29996            1       0.00        7    21   0.00    0.00   \n",
       "29997     10237  29997           54       0.00        4    17   9.25    0.00   \n",
       "29998     10237  29998           10       0.00        5    10   0.00    0.00   \n",
       "29999     10238  29999            2       0.00        4    17   0.00    0.00   \n",
       "\n",
       "       Drinks%  Home%  Beauty%  Health%  Baby%  Pets%  \n",
       "0         3.48   0.00     0.00     0.00    0.0    0.0  \n",
       "1         6.22   2.12     0.00     0.00    0.0    0.0  \n",
       "2         3.37  16.48     6.53     0.00    0.0    0.0  \n",
       "3        11.78   4.62     2.87    15.92    0.0    0.0  \n",
       "4         7.78   7.72     0.00     0.00    0.0    0.0  \n",
       "...        ...    ...      ...      ...    ...    ...  \n",
       "29995    51.30   0.00     0.00     0.00    0.0   42.9  \n",
       "29996     0.00   0.00   100.00     0.00    0.0    0.0  \n",
       "29997    77.48  13.27     0.00     0.00    0.0    0.0  \n",
       "29998   100.00   0.00     0.00     0.00    0.0    0.0  \n",
       "29999     0.00   0.00     0.00     0.00  100.0    0.0  \n",
       "\n",
       "[30000 rows x 14 columns]"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 因为数据量比较大所以对数据做简单的清洗\n",
    "# 订单号一般都是唯一的，所以对订单号进行查重\n",
    "df.drop_duplicates(subset=['order'],inplace=True)\n",
    "# 查看数据类型\n",
    "df.dtypes\n",
    "# 异常值查看\n",
    "df.describe()\n",
    "# 查看折扣率小于0的,并进行降序排序\n",
    "df.loc[df['discount%'] < 0,:].sort_values(by='discount%', ascending=True).head(10)\n",
    "# 查看空值\n",
    "df.isnull().sum()\n",
    "# 使用drop_duplicates()查重\n",
    "df.drop_duplicates(subset=['order'])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1、客户购物时间"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[0, 0, 222],\n",
       " [0, 1, 154],\n",
       " [0, 2, 146],\n",
       " [0, 3, 151],\n",
       " [0, 4, 118],\n",
       " [0, 5, 57],\n",
       " [0, 6, 78],\n",
       " [1, 0, 68],\n",
       " [1, 1, 56],\n",
       " [1, 2, 43],\n",
       " [1, 3, 45],\n",
       " [1, 4, 37],\n",
       " [1, 5, 19],\n",
       " [1, 6, 42],\n",
       " [2, 0, 24],\n",
       " [2, 1, 15],\n",
       " [2, 2, 19],\n",
       " [2, 3, 20],\n",
       " [2, 4, 13],\n",
       " [2, 5, 12],\n",
       " [2, 6, 16],\n",
       " [3, 0, 14],\n",
       " [3, 1, 18],\n",
       " [3, 2, 15],\n",
       " [3, 3, 12],\n",
       " [3, 4, 8],\n",
       " [3, 5, 3],\n",
       " [3, 6, 6],\n",
       " [4, 0, 10],\n",
       " [4, 1, 8],\n",
       " [4, 2, 10],\n",
       " [4, 3, 4],\n",
       " [4, 4, 6],\n",
       " [4, 5, 5],\n",
       " [4, 6, 5],\n",
       " [5, 0, 13],\n",
       " [5, 1, 12],\n",
       " [5, 2, 9],\n",
       " [5, 3, 10],\n",
       " [5, 4, 7],\n",
       " [5, 5, 4],\n",
       " [5, 6, 2],\n",
       " [6, 0, 24],\n",
       " [6, 1, 29],\n",
       " [6, 2, 25],\n",
       " [6, 3, 19],\n",
       " [6, 4, 23],\n",
       " [6, 5, 4],\n",
       " [6, 6, 1],\n",
       " [7, 0, 74],\n",
       " [7, 1, 73],\n",
       " [7, 2, 68],\n",
       " [7, 3, 66],\n",
       " [7, 4, 47],\n",
       " [7, 5, 11],\n",
       " [7, 6, 19],\n",
       " [8, 0, 301],\n",
       " [8, 1, 148],\n",
       " [8, 2, 158],\n",
       " [8, 3, 130],\n",
       " [8, 4, 91],\n",
       " [8, 5, 45],\n",
       " [8, 6, 53],\n",
       " [9, 0, 293],\n",
       " [9, 1, 260],\n",
       " [9, 2, 207],\n",
       " [9, 3, 239],\n",
       " [9, 4, 151],\n",
       " [9, 5, 131],\n",
       " [9, 6, 120],\n",
       " [10, 0, 443],\n",
       " [10, 1, 325],\n",
       " [10, 2, 309],\n",
       " [10, 3, 277],\n",
       " [10, 4, 222],\n",
       " [10, 5, 172],\n",
       " [10, 6, 276],\n",
       " [11, 0, 446],\n",
       " [11, 1, 355],\n",
       " [11, 2, 330],\n",
       " [11, 3, 348],\n",
       " [11, 4, 253],\n",
       " [11, 5, 166],\n",
       " [11, 6, 286],\n",
       " [12, 0, 472],\n",
       " [12, 1, 372],\n",
       " [12, 2, 317],\n",
       " [12, 3, 347],\n",
       " [12, 4, 245],\n",
       " [12, 5, 210],\n",
       " [12, 6, 248],\n",
       " [13, 0, 401],\n",
       " [13, 1, 318],\n",
       " [13, 2, 314],\n",
       " [13, 3, 354],\n",
       " [13, 4, 216],\n",
       " [13, 5, 141],\n",
       " [13, 6, 239],\n",
       " [14, 0, 276],\n",
       " [14, 1, 190],\n",
       " [14, 2, 201],\n",
       " [14, 3, 173],\n",
       " [14, 4, 93],\n",
       " [14, 5, 123],\n",
       " [14, 6, 166],\n",
       " [15, 0, 256],\n",
       " [15, 1, 221],\n",
       " [15, 2, 193],\n",
       " [15, 3, 172],\n",
       " [15, 4, 93],\n",
       " [15, 5, 138],\n",
       " [15, 6, 195],\n",
       " [16, 0, 252],\n",
       " [16, 1, 229],\n",
       " [16, 2, 208],\n",
       " [16, 3, 166],\n",
       " [16, 4, 96],\n",
       " [16, 5, 131],\n",
       " [16, 6, 199],\n",
       " [17, 0, 280],\n",
       " [17, 1, 217],\n",
       " [17, 2, 257],\n",
       " [17, 3, 170],\n",
       " [17, 4, 116],\n",
       " [17, 5, 151],\n",
       " [17, 6, 264],\n",
       " [18, 0, 314],\n",
       " [18, 1, 245],\n",
       " [18, 2, 227],\n",
       " [18, 3, 176],\n",
       " [18, 4, 115],\n",
       " [18, 5, 131],\n",
       " [18, 6, 331],\n",
       " [19, 0, 349],\n",
       " [19, 1, 257],\n",
       " [19, 2, 265],\n",
       " [19, 3, 190],\n",
       " [19, 4, 127],\n",
       " [19, 5, 144],\n",
       " [19, 6, 443],\n",
       " [20, 0, 382],\n",
       " [20, 1, 339],\n",
       " [20, 2, 317],\n",
       " [20, 3, 207],\n",
       " [20, 4, 139],\n",
       " [20, 5, 146],\n",
       " [20, 6, 510],\n",
       " [21, 0, 443],\n",
       " [21, 1, 353],\n",
       " [21, 2, 381],\n",
       " [21, 3, 282],\n",
       " [21, 4, 121],\n",
       " [21, 5, 147],\n",
       " [21, 6, 579],\n",
       " [22, 0, 504],\n",
       " [22, 1, 474],\n",
       " [22, 2, 383],\n",
       " [22, 3, 278],\n",
       " [22, 4, 107],\n",
       " [22, 5, 116],\n",
       " [22, 6, 629],\n",
       " [23, 0, 376],\n",
       " [23, 1, 302],\n",
       " [23, 2, 306],\n",
       " [23, 3, 245],\n",
       " [23, 4, 94],\n",
       " [23, 5, 99],\n",
       " [23, 6, 453]]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 探索客户下单时间的分布情况，可以进行分组分析\n",
    "group_time = df.groupby(by=['hour','weekday'])['order'].count()\n",
    "group_time\n",
    "\n",
    "# 热力图横轴、纵轴数据构造\n",
    "x_list = [str(i+1) for i in range(24)]\n",
    "y_list = ['周一','周二','周三','周四','周五','周六','周天']\n",
    "# 热力图数据构造\n",
    "hour_list = [i+1 for i in range(24)]\n",
    "day_list = [i+1 for i in range(7)]\n",
    "value_list = []\n",
    "for i in range(len(hour_list)):\n",
    "    for j in range(len(day_list)):\n",
    "        try:\n",
    "            value_list.append([i,j,int(group_time[i,day_list[j]])])     # 因为考虑到分组分析中无对应索引,所以会报错\n",
    "        except Exception as e:\n",
    "#             print(e)\n",
    "            value_list.append([i,j,0])      # 无对应索引的值赋值为0\n",
    "value_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'f:\\\\Python\\\\06_数据挖掘\\\\project\\\\顾客购物订单分析\\\\tmp\\\\客户购买时间分布热力图.html'"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import HeatMap\n",
    "c = (\n",
    "    HeatMap(init_opts=opts.InitOpts(width=\"800px\", height=\"400px\"))\n",
    "    .add_xaxis(xaxis_data=x_list)\n",
    "    .add_yaxis(\n",
    "        series_name=\"下单人数\",\n",
    "        yaxis_data=y_list,\n",
    "        value=value_list,\n",
    "        label_opts=opts.LabelOpts(\n",
    "                                is_show=True, \n",
    "                                color=\"#fff\", \n",
    "                                position=\"inside\", \n",
    "        ),\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        legend_opts=opts.LegendOpts(is_show=False),\n",
    "        xaxis_opts=opts.AxisOpts(\n",
    "            type_=\"category\",\n",
    "            splitarea_opts=opts.SplitAreaOpts(\n",
    "                is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)  # opacity 网格线的透明度\n",
    "            ),\n",
    "        ),\n",
    "        yaxis_opts=opts.AxisOpts(\n",
    "            type_=\"category\",\n",
    "            splitarea_opts=opts.SplitAreaOpts(\n",
    "                is_show=True, areastyle_opts=opts.AreaStyleOpts(opacity=1)\n",
    "            ),\n",
    "        ),\n",
    "        visualmap_opts=opts.VisualMapOpts(\n",
    "            min_=0, max_=400, \n",
    "            orient=\"horizontal\",\n",
    "            pos_left=\"center\",\n",
    "            range_color = ['#7fb80e','#f58220','red']\n",
    "        ),\n",
    "    )\n",
    ")\n",
    "c.render(\"../tmp/客户购买时间分布热力图.html\") \n",
    "# c.render_notebook()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2、客户回购率"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 对客户的购买次数做分组分析\n",
    "customer = df.groupby(by=\"customer\")['customer'].count().sort_values(ascending=False)  # 进行降序排序\n",
    "# 构造表格对象\n",
    "customer_list = []\n",
    "for i in range(len(customer)):\n",
    "    customer_list.append([customer.index[i],customer.values[i]])\n",
    "customer = pd.DataFrame(customer_list,columns=[\"客户ID\",\"下单次数\"])\n",
    "# 将数据暂存\n",
    "customer.to_csv(\"../tmp/customer.csv\",index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>客户ID</th>\n",
       "      <th>下单次数</th>\n",
       "      <th>客户类型</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6560</td>\n",
       "      <td>52</td>\n",
       "      <td>忠诚客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>7688</td>\n",
       "      <td>40</td>\n",
       "      <td>忠诚客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>7776</td>\n",
       "      <td>37</td>\n",
       "      <td>忠诚客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>657</td>\n",
       "      <td>36</td>\n",
       "      <td>忠诚客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>4713</td>\n",
       "      <td>31</td>\n",
       "      <td>忠诚客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10234</th>\n",
       "      <td>4764</td>\n",
       "      <td>1</td>\n",
       "      <td>流失客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10235</th>\n",
       "      <td>4763</td>\n",
       "      <td>1</td>\n",
       "      <td>流失客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10236</th>\n",
       "      <td>4762</td>\n",
       "      <td>1</td>\n",
       "      <td>流失客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10237</th>\n",
       "      <td>4761</td>\n",
       "      <td>1</td>\n",
       "      <td>流失客户</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10238</th>\n",
       "      <td>10238</td>\n",
       "      <td>1</td>\n",
       "      <td>流失客户</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10239 rows × 3 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "        客户ID  下单次数  客户类型\n",
       "0       6560    52  忠诚客户\n",
       "1       7688    40  忠诚客户\n",
       "2       7776    37  忠诚客户\n",
       "3        657    36  忠诚客户\n",
       "4       4713    31  忠诚客户\n",
       "...      ...   ...   ...\n",
       "10234   4764     1  流失客户\n",
       "10235   4763     1  流失客户\n",
       "10236   4762     1  流失客户\n",
       "10237   4761     1  流失客户\n",
       "10238  10238     1  流失客户\n",
       "\n",
       "[10239 rows x 3 columns]"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 数据读取\n",
    "df_customer = pd.read_csv(\"../tmp/customer.csv\")\n",
    "# 对数据进行分箱处理\n",
    "customer_cut = pd.cut(  df_customer['下单次数'],\n",
    "                        bins=[0,2,10,30,60],\n",
    "                        labels=['流失客户','边缘客户','潜在客户','忠诚客户']\n",
    "                    )\n",
    "df_customer['客户类型'] = customer_cut\n",
    "df_customer"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'f:\\\\Python\\\\06_数据挖掘\\\\project\\\\顾客购物订单分析\\\\tmp\\\\客户回购次数分类占比.html'"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 画玫瑰图(饼图)\n",
    "from pyecharts.charts import Pie\n",
    "from pyecharts import options as opts\n",
    "# 数据准备\n",
    "customer_type_count = df_customer.groupby('客户类型')['客户类型'].count()\n",
    "list = [[i,int(j)] for i,j in zip(customer_type_count.index.tolist(),customer_type_count.values.tolist())]\n",
    "list \n",
    "c = (\n",
    "    Pie(init_opts=opts.InitOpts(width=\"800px\", height=\"600px\")) # 设置背景的大小\n",
    "    .add(\n",
    "        series_name = \"客户占比区间\",    # 必须项\n",
    "        data_pair = list,\n",
    "        radius=[\"20%\", \"50%\"],          # 设置环的大小\n",
    "        # center=[\"20%\", \"50%\"],        # 设置饼图的位置\n",
    "        rosetype=\"radius\",              # 设置玫瑰图类型\n",
    "        label_opts=opts.LabelOpts(\n",
    "            position=\"outside\",\n",
    "            formatter=\"{a|{a}}{abg|}\\n{hr|}\\n {b|{b}的个数: }{c}个  {per|{d}%}  \",\n",
    "            background_color=\"#eee\",\n",
    "            border_color=\"#aaa\",\n",
    "            border_width=2,\n",
    "            border_radius=4,\n",
    "            rich={\n",
    "                \"a\": {\"color\": \"#999\", \"lineHeight\": 20, \"align\": \"center\"},\n",
    "                \"abg\": {\n",
    "                    \"backgroundColor\": \"#e3e3e3\",\n",
    "                    \"width\": \"100%\",\n",
    "                    \"align\": \"right\",\n",
    "                    \"height\": 22,\n",
    "                    \"borderRadius\": [4, 4, 0, 0],\n",
    "                },\n",
    "                \"hr\": {\n",
    "                    \"borderColor\": \"#aaa\",\n",
    "                    \"width\": \"100%\",\n",
    "                    \"borderWidth\": 0.5,\n",
    "                    \"height\": 0,\n",
    "                },\n",
    "                \"b\": {\"fontSize\": 14, \"lineHeight\": 35},\n",
    "                \"per\": {\n",
    "                    \"color\": \"#eee\",\n",
    "                    \"backgroundColor\": \"#334455\",\n",
    "                    \"padding\": [2, 5],\n",
    "                    \"borderRadius\": 2,\n",
    "                },\n",
    "            }\n",
    "         ) # 设置标签内容格式\n",
    "        \n",
    "    )\n",
    "    .set_colors([\"#7fb80e\", \"#007d65\", \"#fcaf17\", \"#FF7256\"]) # 颜色设置\n",
    "    .set_global_opts(title_opts=opts.TitleOpts(title=\"客户回购次数分类占比\"),\n",
    "                    legend_opts=opts.LegendOpts(\n",
    "                        pos_top=\"3%\",\n",
    "                        pos_left=\"90%\",\n",
    "                        orient='vertical'\n",
    "                    \n",
    "                    ),                              # 设置图示的位置\n",
    "                    )\n",
    "    \n",
    ")\n",
    "c.render(\"../tmp/客户回购次数分类占比.html\")\n",
    "# c.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3、折扣百分比和购买商品数量分析\n",
    "- 可以通过散点图来观察"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'f:\\\\Python\\\\06_数据挖掘\\\\project\\\\顾客购物订单分析\\\\tmp\\\\折扣百分比和购买商品数量散点图.html'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Scatter\n",
    "# 构造散点图数据\n",
    "total_items_list = df['total_items']\n",
    "discout_list = df['discount%']\n",
    "c = (\n",
    "    Scatter()\n",
    "    .add_xaxis(xaxis_data=total_items_list)\n",
    "    .add_yaxis(\n",
    "        series_name=\"\",\n",
    "        y_axis=discout_list,\n",
    "        symbol_size=3,\n",
    "        label_opts=opts.LabelOpts(is_show=False),\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(title=\"折扣百分比和购买商品数量散点图:\")\n",
    "    )\n",
    ")\n",
    "c.render(\"../tmp/折扣百分比和购买商品数量散点图.html\")\n",
    "# c.render_notebook()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4、商品分析"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 构造柱形图数据\n",
    "x_list = ['非生鲜食物','生鲜类食物','饮料','家用品','美妆类产品','保健类产品','母婴类','宠物用品']\n",
    "food = round(df['Food%'].mean(),2)\n",
    "fresh = round(df['Fresh%'].mean(),2)\n",
    "drinks = round(df['Drinks%'].mean(),2)\n",
    "home = round(df['Home%'].mean(),2)\n",
    "beauty = round(df['Beauty%'].mean(),2)\n",
    "health = round(df['Health%'].mean(),2)\n",
    "baby = round(df['Baby%'].mean(),2)\n",
    "pets = round(df['Pets%'].mean(),2)\n",
    "y_list = [food,fresh,drinks,home,beauty,health,baby,pets]\n",
    "# 对数据进行排序\n",
    "x_y_list = [[i,j]for i,j in zip(x_list,y_list)]\n",
    "x_y_list.sort(key=lambda x : x[1],reverse=False)\n",
    "\n",
    "x = []\n",
    "y = []\n",
    "for i in range(len(x_list)):\n",
    "    x.append(x_y_list[i][0])\n",
    "    y.append(x_y_list[i][1])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'f:\\\\Python\\\\06_数据挖掘\\\\project\\\\顾客购物订单分析\\\\tmp\\\\平均购买商品柱状图.html'"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 画柱形图\n",
    "import pyecharts.options as opts\n",
    "from pyecharts.charts import Bar, Line\n",
    "bar = (\n",
    "    Bar(init_opts=opts.InitOpts(width='800px',height='400px'))\n",
    "    .add_xaxis(xaxis_data=x)\n",
    "    .add_yaxis(\n",
    "        series_name=\"\",\n",
    "        y_axis=y,\n",
    "        label_opts=opts.LabelOpts(is_show = False),\n",
    "        color = 'skyblue',\n",
    "    )\n",
    "    .set_global_opts(\n",
    "        title_opts=opts.TitleOpts(\"平均购买商品(占总价格百分比):\")\n",
    "    )\n",
    "    # 反转x和y轴\n",
    "    .reversal_axis()\n",
    ")\n",
    "# bar.render_notebook()\n",
    "bar.render(\"../tmp/平均购买商品柱状图.html\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'f:\\\\Python\\\\06_数据挖掘\\\\project\\\\顾客购物订单分析\\\\tmp\\\\按周次的商品销售占比时间柱状图.html'"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from pyecharts.charts import Bar,Timeline\n",
    "from pyecharts.options import LabelOpts,TitleOpts\n",
    "from pyecharts.globals import ThemeType\n",
    "# 对周次和商品进行分组聚合\n",
    "week_commodity = df.groupby(by='weekday')[['Food%','Fresh%','Drinks%','Home%','Beauty%','Health%','Baby%','Pets%']].mean()\n",
    "\n",
    "# 创建时间线对象\n",
    "timeline = Timeline({\"theme\":ThemeType.LIGHT})\n",
    "\n",
    "for week in range(len(week_commodity)):\n",
    "    x_list = ['非生鲜食物','生鲜类食物','饮料','家用品','美妆类产品','保健类产品','母婴类','宠物用品']\n",
    "    y_list = week_commodity.loc[week+1,:].values\n",
    "    y_list = [round(j,2) for j in y_list]\n",
    "    x_y_list = [[i,j]for i,j in zip(x_list,y_list)]\n",
    "    # 对数据进行排序\n",
    "    x_y_list.sort(key=lambda x : x[1],reverse=False)\n",
    "    # 获取最终数据\n",
    "    x = []\n",
    "    y = []\n",
    "    for i in range(len(x_list)):\n",
    "        x.append(x_y_list[i][0])\n",
    "        y.append(x_y_list[i][1])\n",
    "    \n",
    "    # 构建柱状图对象\n",
    "    bar = Bar()\n",
    "    bar.add_xaxis(xaxis_data=x) # 添加x轴数据\n",
    "    bar.add_yaxis(\n",
    "        \"总价百分比%\", \n",
    "        y,  # y轴数据\n",
    "        label_opts=LabelOpts(is_show=False),    # 不显示标签数据\n",
    "    )\n",
    "    # 反转x轴和y轴\n",
    "    bar.reversal_axis()\n",
    "\n",
    "    # 设置每一周图表的标题\n",
    "    bar.set_global_opts(\n",
    "        title_opts=TitleOpts(title=f\"周 {week+1} 的商品销售占比\")\n",
    "    )\n",
    "    # 添加时间轴\n",
    "    timeline.add(bar,str(week+1))\n",
    "\n",
    "# 设置自动播放\n",
    "timeline.add_schema(\n",
    "    play_interval=2000,     # 自动播放的时间间隔(毫秒)\n",
    "    is_timeline_show=True,  # 是否在自动播放的时候显示时间线\n",
    "    is_auto_play=True,      # 是否自动播放\n",
    "    is_loop_play=False       # 是否循环播放\n",
    ")\n",
    "\n",
    "# timeline.render_notebook()\n",
    "timeline.render(\"../tmp/按周次的商品销售占比时间柱状图.html\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5、相关矩阵"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Food%</th>\n",
       "      <th>Fresh%</th>\n",
       "      <th>Drinks%</th>\n",
       "      <th>Home%</th>\n",
       "      <th>Beauty%</th>\n",
       "      <th>Health%</th>\n",
       "      <th>Baby%</th>\n",
       "      <th>Pets%</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Food%</th>\n",
       "      <td>1.00</td>\n",
       "      <td>0.03</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>0.00</td>\n",
       "      <td>-0.26</td>\n",
       "      <td>-0.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Fresh%</th>\n",
       "      <td>0.03</td>\n",
       "      <td>1.00</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>0.01</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Drinks%</th>\n",
       "      <td>-0.02</td>\n",
       "      <td>-0.14</td>\n",
       "      <td>1.00</td>\n",
       "      <td>0.04</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>-0.17</td>\n",
       "      <td>-0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Home%</th>\n",
       "      <td>-0.04</td>\n",
       "      <td>-0.11</td>\n",
       "      <td>0.04</td>\n",
       "      <td>1.00</td>\n",
       "      <td>0.12</td>\n",
       "      <td>0.04</td>\n",
       "      <td>-0.08</td>\n",
       "      <td>0.02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Beauty%</th>\n",
       "      <td>-0.02</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>-0.05</td>\n",
       "      <td>0.12</td>\n",
       "      <td>1.00</td>\n",
       "      <td>0.11</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Health%</th>\n",
       "      <td>0.00</td>\n",
       "      <td>0.01</td>\n",
       "      <td>-0.03</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.11</td>\n",
       "      <td>1.00</td>\n",
       "      <td>-0.01</td>\n",
       "      <td>0.03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Baby%</th>\n",
       "      <td>-0.26</td>\n",
       "      <td>-0.18</td>\n",
       "      <td>-0.17</td>\n",
       "      <td>-0.08</td>\n",
       "      <td>-0.07</td>\n",
       "      <td>-0.01</td>\n",
       "      <td>1.00</td>\n",
       "      <td>-0.06</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Pets%</th>\n",
       "      <td>-0.00</td>\n",
       "      <td>0.02</td>\n",
       "      <td>-0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.03</td>\n",
       "      <td>-0.06</td>\n",
       "      <td>1.00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         Food%  Fresh%  Drinks%  Home%  Beauty%  Health%  Baby%  Pets%\n",
       "Food%     1.00    0.03    -0.02  -0.04    -0.02     0.00  -0.26  -0.00\n",
       "Fresh%    0.03    1.00    -0.14  -0.11    -0.02     0.01  -0.18   0.02\n",
       "Drinks%  -0.02   -0.14     1.00   0.04    -0.05    -0.03  -0.17  -0.02\n",
       "Home%    -0.04   -0.11     0.04   1.00     0.12     0.04  -0.08   0.02\n",
       "Beauty%  -0.02   -0.02    -0.05   0.12     1.00     0.11  -0.07   0.03\n",
       "Health%   0.00    0.01    -0.03   0.04     0.11     1.00  -0.01   0.03\n",
       "Baby%    -0.26   -0.18    -0.17  -0.08    -0.07    -0.01   1.00  -0.06\n",
       "Pets%    -0.00    0.02    -0.02   0.02     0.03     0.03  -0.06   1.00"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 提取出相关数据\n",
    "commodity = df[['Food%','Fresh%','Drinks%','Home%','Beauty%','Health%','Baby%','Pets%']]\n",
    "# 将数据暂存到tmp中\n",
    "commodity.to_csv(\"../tmp/commodity.csv\",index=False)\n",
    "\n",
    "# 读取文件\n",
    "df_commodity = pd.read_csv(\"../tmp/commodity.csv\")\n",
    "# 因为其变量比较离散，且属于非线性关系，所有选择斯皮尔曼相关系数\n",
    "commodity_corr = df_commodity.corr(method='kendall').round(2)\n",
    "commodity_corr"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3.9.13 ('base')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.13"
  },
  "orig_nbformat": 4,
  "vscode": {
   "interpreter": {
    "hash": "79c2bc36f36ebca92fe5f3c73355a3866f3a34a4fd0b1d43087d5313dd5fd5ff"
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
